

package com.hazelcast.internal.partition;

import com.hazelcast.cluster.Address;

/**
 * Internal event that is dispatched to {@link PartitionAwareService#onPartitionLost}
 * <p>
 * It contains the partition ID, number of replicas that is lost and the address of node that detects the partition lost.
 */
public interface IPartitionLostEvent {

    /**
     * The partition ID that is lost.
     *
     * @return the partition ID that is lost
     */
    int getPartitionId();

    /**
     * 0-based replica index that is lost for the partition.
     * <p>
     * For instance, 0 means only the owner of the partition is lost, 1 means both the owner and first backup are lost.
     *
     * @return 0-based replica index that is lost for the partition
     */
    int getLostReplicaIndex();

    /**
     * The address of the node that detects the partition lost.
     *
     * @return the address of the node that detects the partition lost
     */
    Address getEventSource();

}
